#include "SW_18010P.h"
#include "iot_adc.h"
#include "iot_errno.h"
#include "iot_gpio.h"
#include "iot_gpio_ex.h"
#include "iot_pwm.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define VIBRATION_IOT_IO_NAME_GPIO 9

int SW18010PGet(void)
{
    int value = 1;
    if (IoTGpioGetInputVal(VIBRATION_IOT_IO_NAME_GPIO, &value) != 0) {
        printf("[ERROR][%s|%d] IoTGpioGetInputVal failed! \n", __func__, __LINE__);
        return 0;
    }
    return value ? SW18010_OFF : SW18010_ON;
}
void SW18010PInit(void)
{
    IoTGpioInit(VIBRATION_IOT_IO_NAME_GPIO);
    hi_io_set_func(VIBRATION_IOT_IO_NAME_GPIO, 0);
    IoTGpioSetDir(VIBRATION_IOT_IO_NAME_GPIO, IOT_GPIO_DIR_IN);
}
